//
//  MLSignView.m
//  ZHJX(new)
//
//  Created by 杨磊 on 2021/2/1.
//  Copyright © 2021 杨磊. All rights reserved.
//

#import "MLSignView.h"

@interface MLSignView()<UIGestureRecognizerDelegate>

@end

@implementation MLSignView

+(instancetype)shareSignView{
    static MLSignView *loadView = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        //不能再使用alloc方法
        loadView = [[MLSignView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width,  [UIScreen mainScreen].bounds.size.height)];
    });

    return loadView;

}


- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor colorWithWhite:.5 alpha:.5];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapAction:)];
        tap.delegate = self;
        [self addGestureRecognizer:tap];
        

    }
    return self;
}

- (void)tapAction:(UIGestureRecognizer *)gesture{
    [self dismissView];
}

- (void)dismissView{
    [self removeFromSuperview];
}

- (void)showView{
    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
    imageView.image = [UIImage imageNamed:@"进出校默认图"];
    [self addSubview:imageView];
}
//-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(nonnull UITouch *)touch {
//    if ([touch.view isDescendantOfView:self.tableView]) {
//          return NO;
//      }
//      return YES;
//}

@end
